/**
 * <p>Title: SmsDeviceCatSetting.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-6-29 上午07:57:23  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.common.zm.cInterface.ct;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.sczx.common.zm.basetools.StaticTools;

/**
 * 短信猫生成短信类
 * <p>Title: SmsDeviceCatSetting.java</p>
 * <p>Description: 使用短信猫发送短信</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-6-29 上午07:57:23  张志芳  Create
 *</pre>
 */
public class SmsDeviceCatSetting implements IgenerateSms {
	private Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	public SmsDeviceCatSetting()
	{
		
	}
	
	/**
	 * 发送短信(批量)
	 * <p>Function: generateSms</p>
	 * <p>Description: List中的Map中应该有键值对为：content(短信内容), mobileNum(手机号码), createTime(短信生成时间)</p>
	 * <p>return value: SmsDeviceCatSetting</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-6-29上午07:57:23 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void generateSms(List<Map> list) {
		// TODO Auto-generated method stub
		for(Map map : list)
		{
            String id=StaticTools.getDateTime("yyyyMMddHHmmss");//主键           
            long rad=(long)(Math.random()*100000000);
            id += rad;
            Map param = new HashMap();
            param.put("id", id);
            param.put("receiver", map.get("mobileNum"));
            param.put("content", map.get("content"));
            param.put("inserttime", map.get("createTime"));
            param.put("retrytimes", "0");
            param.put("pri", "1");
            param.put("inpool", "0");
            param.put("sendmode", "1");
            param.put("sendtime", StaticTools.getDateTime());
            dao.insert("ZMCTSmsBoxsending.insert", param);
		}
	}

}
